<?php
declare(strict_types=1);

namespace Core\Package\ElementPlus\Component;

/**
 * 按钮组件
 */
class AlertComponent extends ComponentAbstract
{
    protected string $_type = 'el-alert';

    protected string $_title = '';

    protected function defaultProps(): array
    {
        return [
            'type' => 'info',
            'show-icon' => true
        ];
    }

    public function __construct(string $title, string $type = 'info')
    {
        $this->_props['title'] = $title;
        $this->_props['type'] = $type;
    }

    /**
     * 设置描述
     * @param string $description
     * @return $this
     */
    public function description(string $description): static
    {
        $this->_props['description'] = $description;
        return $this;
    }

    /**
     * 图标设置
     * @param bool $show
     * @return $this
     */
    public function icon(bool $show): static
    {
        $this->_props['show-icon'] = $show;
        return $this;
    }
}